﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace ExpressionEvaluator.Anonymous
{
    internal class AnonymousArgument
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="AnonymousArgument"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        public AnonymousArgument(string name)
        {
            Name = name;
        }
        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value>The name.</value>
        public string Name { get; private set; }
        /// <summary>
        /// Gets the name of the generic argument.
        /// </summary>
        /// <value>The name of the generic argument.</value>
        public string GenericArgumentName
        {
            get
            {
                return string.Format("<{0}>j__TPar", Name);
            }
        }

        /// <summary>
        /// Gets the name of the generic field.
        /// </summary>
        /// <value>The name of the generic field.</value>
        public string GenericFieldName
        {
            get
            {
                return string.Format("<{0}>i_Field", Name);
            }
        }

        /// <summary>
        /// Gets the type of the generated.
        /// </summary>
        /// <value>The type of the generated.</value>
        public Type GeneratedType { get; private set; }

        /// <summary>
        /// Assigns the generated type.
        /// </summary>
        /// <param name="generatedType">The generated type.</param>
        internal void AssignGeneratedType(Type generatedType)
        {
            GeneratedType = generatedType;
        }

        /// <summary>
        /// Gets the field.
        /// </summary>
        /// <value>The field.</value>
        public FieldInfo Field { get; private set; }

        /// <summary>
        /// Assigns the field.
        /// </summary>
        /// <param name="field">The field.</param>
        internal void AssignField(FieldInfo field)
        {
            Field = field;
        }
    }
}
